<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="wrapper">
      <button id="myButton">点击我</button>
      <ul id="list">
        <li>项目1</li>
        <li>项目2</li>
        <li>项目3</li>
      </ul>
    </div>
  </body>
  <script>
    const button = document.getElementById("myButton");
    const div = document.getElementById("wrapper");
    function test(e) {
      console.log(e);
      if (e.key === "enter") {
        fdsfds;
      }
      //   alert("第一次点击");
    }
    function test1() {
      alert("第二次点击");
    }

    button.addEventListener("keydown", test);

    // div.addEventListener("click", test1, true);
    const liArray = document.querySelectorAll("li");
    liArray.forEach((liDom) => {
      liDom.addEventListener("click", () => {});
    });
  </script>
</html>
